this.BX=this.BX||{};(function(t,e,n,i,c,o,s,l){"use strict";var a={props:["sections"],methods:{handleClick:function t(e){this.$emit("sectionToggled",e)},getSectionsItemClassName:function t(e){return["ui-checkbox-list__sections-item",{"--checked":e}]}},template:'\n\t\t<div class="ui-checkbox-list__sections">\n\t\t\t<div \n\t\t\t\tv-for="section in sections"\n\t\t\t\t:key="section.key"\n\t\t\t\t:title="section.title"\n\t\t\t\t:class="getSectionsItemClassName(section.value)"\n\t\t\t\t@click="handleClick(section.key)"\n\t\t\t>\n\t\t\t\t<div class="ui-checkbox-list__check-box"></div>\n\t\t\t\t{{ section.title }}\n\t\t\t</div>\n\t\t</div>\n\t'};var r={props:["columnCount","category","options"],methods:{handleCheckBox:function t(e){this.$emit("changeOption",e)},getOptionClassName:function t(e){return["ui-ctl","ui-ctl-checkbox","ui-checkbox-list__field-item_label",{"--checked":e}]}},template:'\n\t\t<div class="ui-checkbox-list__category">\n\t\t\t<div class="ui-checkbox-list__categories-title">\n\t\t\t\t{{ category.title }}\n\t\t\t</div>\n\t\t\t<div \n\t\t\t\tclass="ui-checkbox-list__options"\n\t\t\t\t:style="{\'-webkit-column-count\': columnCount, \n\t\t\t\t\t\t \'-moz-column-count\': columnCount, \n\t\t\t\t\t\t \'column-count\': columnCount,\n\t\t\t\t\t\t }"\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tv-for="option in options"\n\t\t\t\t\t:key="option.id"\n\t\t\t\t>\n\t\t\t\t\t<label\n\t\t\t\t\t\t:title="option.title"\n\t\t\t\t\t\t:class="getOptionClassName(option.value)"\n\t\t\t\t\t>\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\ttype="checkbox"\n\t\t\t\t\t\t\tclass="ui-ctl-element ui-checkbox-list__field-item_input"\n\t\t\t\t\t\t\t:checked="option.value"\n\t\t\t\t\t\t\t@click="handleCheckBox(option.id)"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t<div class="ui-ctl-label-text ui-checkbox-list__field-item_text">{{ option.title }}</div>\n\t\t\t\t\t</label>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t'};var u={components:{CheckboxListSections:a,CheckboxListCategory:r},props:["dialog","popup","columnCount","compactField","lang","sections","categories","options"],data:function t(){return{dataSections:this.sections,dataCategories:this.categories,dataOptions:this.options,dataCompactField:this.compactField,search:"",longContent:false,scrollIsBottom:true,scrollIsTop:false}},methods:{renderSwitcher:function t(){var e=this;if(this.dataCompactField){var n=new BX.UI.Switcher({node:this.$refs.switcher,checked:this.dataCompactField.value,size:"small",handlers:{toggled:function t(){return e.handleSwitcherToggled()}}})}},handleSwitcherToggled:function t(){this.dataCompactField.value=!this.dataCompactField.value},handleCheckBoxToggled:function t(e){var n=this.dataOptions.find((function(t){return t.id===e}));if(n){n.value=!n.value}},clearSearch:function t(){this.search=""},handleClearSearchButtonClick:function t(){this.$refs.searchInput.focus();this.clearSearch()},handleSectionsToggled:function t(e){var n=this.dataSections.find((function(t){return t.key===e}));if(n){n.value=!n.value}},getOptionsByCategory:function t(e){return this.optionsByTitle.filter((function(t){return t.categoryKey===e}))},getCheckedOptionsId:function t(){return this.dataOptions.filter((function(t){return t.value===true})).map((function(t){return t.id}))},checkLongContent:function t(){if(this.$refs.container){this.longContent=this.$refs.container.clientHeight<this.$refs.container.scrollHeight}else{this.longContent=false}},getBottomIndent:function t(){this.scrollIsBottom=!(this.$refs.container.scrollTop+this.$refs.container.clientHeight>=this.$refs.container.scrollHeight-10)},getTopIndent:function t(){this.scrollIsTop=this.$refs.container.scrollTop},handleScroll:function t(){this.getBottomIndent();this.getTopIndent()},handleSearchEscKeyUp:function t(){this.$refs.container.focus();this.clearSearch()},defaultSettings:function t(){this.clearSearch();if(this.dataCompactField&&this.dataCompactField.value!==this.dataCompactField.defaultValue){this.$refs.switcher.click()}this.dataOptions.forEach((function(t){return t.value=t.defaultValue}));if(Array.isArray(this.dataSections)){this.dataSections.forEach((function(t){return t.value=true}))}},selectAll:function t(){var e=this;this.categoryBySection.forEach((function(t){e.getOptionsByCategory(t.key).forEach((function(t){return t.value=true}))}))},deselectAll:function t(){var e=this;this.categoryBySection.forEach((function(t){e.getOptionsByCategory(t.key).forEach((function(t){return t.value=false}))}))},cancel:function t(){this.popup.destroy()},apply:function t(){s.EventEmitter.emit(this.dialog,"onApply",{switcher:this.dataCompactField,fields:this.getCheckedOptionsId()});this.popup.destroy()}},watch:{search:function t(){var e=this;this.$nextTick((function(){e.checkLongContent()}))},categoryBySection:function t(){var e=this;this.$nextTick((function(){e.checkLongContent()}))}},computed:{visibleOptions:function t(){var e=this;if(!Array.isArray(this.dataSections)||!this.dataSections.length){return this.optionsByTitle}return this.optionsByTitle.filter((function(t){var n=e.dataCategories.find((function(e){return e.key===t.categoryKey}));var i=e.dataSections.find((function(t){return t.key===n.sectionKey}));return i===null||i===void 0?void 0:i.value}))},isEmptyContent:function t(){return this.visibleOptions.length>0},isSearchDisabled:function t(){if(this.dataSections){return!this.dataSections.some((function(t){return t.value}))}return false},optionsByTitle:function t(){var e=this;return this.dataOptions.filter((function(t){return t.title.toLowerCase().indexOf(e.search.toLowerCase())!==-1}))},categoryBySection:function t(){var e=this;if(!Array.isArray(this.dataSections)||!l.Type.isArrayFilled(this.dataSections)){return this.dataCategories}return this.dataCategories.filter((function(t){var n=e.dataSections.find((function(e){return t.sectionKey===e.key}));return n===null||n===void 0?void 0:n.value}))},wrapperClassName:function t(){return["ui-checkbox-list__wrapper",{"--long":this.longContent},{"--bottom":this.scrollIsBottom},{"--top":this.scrollIsTop}]},searchClassName:function t(){return["ui-checkbox-list__search",{"--disabled":this.isSearchDisabled}]},SwitcherText:function t(){return l.Type.isStringFilled(this.lang.switcher)?this.lang.switcher:l.Loc.getMessage("UI_CHECKBOX_LIST_DEFAULT_SETTINGS_SWITCHER")},placeholderText:function t(){return l.Type.isStringFilled(this.lang.placeholder)?this.lang.placeholder:l.Loc.getMessage("UI_CHECKBOX_LIST_DEFAULT_SETTINGS_PLACEHOLDER")},defaultSettingsBtnText:function t(){return l.Type.isStringFilled(this.lang.defaultBtn)?this.lang.defaultBtn:l.Loc.getMessage("UI_CHECKBOX_LIST_DEFAULT_SETTINGS")},applyBtnText:function t(){return l.Type.isStringFilled(this.lang.acceptBtn)?this.lang.acceptBtn:l.Loc.getMessage("UI_CHECKBOX_LIST_DEFAULT_ACCEPT_BUTTON")},cancelBtnText:function t(){return l.Type.isStringFilled(this.lang.cancelBtn)?this.lang.cancelBtn:l.Loc.getMessage("UI_CHECKBOX_LIST_DEFAULT_CANCEL_BUTTON")},selectAllBtnText:function t(){return l.Type.isStringFilled(this.lang.selectAllBtn)?this.lang.selectAllBtn:l.Loc.getMessage("UI_CHECKBOX_LIST_DEFAULT_SELECT_ALL")},deselectAllBtnText:function t(){return l.Type.isStringFilled(this.lang.deselectAllBtn)?this.lang.deselectAllBtn:l.Loc.getMessage("UI_CHECKBOX_LIST_DEFAULT_SETTINGS_DESELECT_ALL")},emptyStateTitleText:function t(){return l.Loc.getMessage("UI_CHECKBOX_LIST_DEFAULT_SETTINGS_EMPTY_STATE_TITLE")},emptyStateDescriptionText:function t(){return l.Loc.getMessage("UI_CHECKBOX_LIST_DEFAULT_SETTINGS_EMPTY_STATE_DESCRIPTION")}},mounted:function t(){var e=this;this.renderSwitcher();this.$nextTick((function(){e.checkLongContent()}))},template:'\n\t\t<div class="ui-checkbox-list">\n\t\t<div class="ui-checkbox-list__header">\n\n\t\t\t<checkbox-list-sections\n\t\t\t\tv-if="sections"\n\t\t\t\t:sections="dataSections"\n\t\t\t\t@sectionToggled="handleSectionsToggled"\n\t\t\t/>\n\n\t\t\t<div class="ui-checkbox-list__header_options">\n\t\t\t\t<div\n\t\t\t\t\tv-if="compactField"\n\t\t\t\t\tclass="ui-checkbox-list__switcher"\n\t\t\t\t>\n\t\t\t\t\t<div class="ui-checkbox-list__switcher-text">\n\t\t\t\t\t\t{{ SwitcherText }}\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class="switcher" ref="switcher"></div>\n\t\t\t\t</div>\n\t\t\t\t<div\n\t\t\t\t\t:class="searchClassName"\n\t\t\t\t>\n\t\t\t\t\t<div class="ui-checkbox-list__search-wrapper">\n\t\t\t\t\t\t<div class="ui-ctl ui-ctl-textbox ui-ctl-before-icon ui-ctl-after-icon ui-ctl-w100">\n\n\t\t\t\t\t\t\t<div class="ui-ctl-before ui-ctl-icon-search"></div>\n\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t@click="handleClearSearchButtonClick"\n\t\t\t\t\t\t\t\tclass="ui-ctl-after ui-ctl-icon-clear ui-checkbox-list__search-clear"\n\t\t\t\t\t\t\t></button>\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t:placeholder="placeholderText"\n\t\t\t\t\t\t\t\ttype="text"\n\t\t\t\t\t\t\t\tclass="ui-ctl-element"\n\t\t\t\t\t\t\t\tv-model="search"\n\t\t\t\t\t\t\t\t@keyup.esc.stop="handleSearchEscKeyUp"\n\t\t\t\t\t\t\t\tref="searchInput"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<div\n\t\t\tref="wrapper"\n\t\t\t:class="wrapperClassName"\n\t\t>\n\t\t\t<div\n\t\t\t\tref="container"\n\t\t\t\tclass="ui-checkbox-list__container"\n\t\t\t\t@scroll="handleScroll"\n\t\t\t\ttabindex="0"\n\t\t\t\tv-if="isEmptyContent"\n\t\t\t>\n\t\t\t\t<checkbox-list-category\n\t\t\t\t\tv-for="category in categoryBySection"\n\t\t\t\t\t:key="category.key"\n\t\t\t\t\t:category="category"\n\t\t\t\t\t:columnCount="columnCount"\n\t\t\t\t\t:options="getOptionsByCategory(category.key)"\n\t\t\t\t\t@changeOption="handleCheckBoxToggled"\n\t\t\t\t/>\n\t\t\t</div>\n\t\t\t<div\n\t\t\t\tv-else\n\t\t\t\tclass="ui-checkbox-list__empty"\n\t\t\t>\n\t\t\t\t<img\n\t\t\t\t\tsrc="/bitrix/js/ui/dialogs/checkbox-list/images/ui-checkbox-list-empty.svg"\n\t\t\t\t\t:alt="emptyStateTitleText">\n\t\t\t\t<div class="ui-checkbox-list__empty-title">\n\t\t\t\t\t{{ emptyStateTitleText }}\n\t\t\t\t</div>\n\t\t\t\t<div class="ui-checkbox-list__empty-description">\n\t\t\t\t\t{{ emptyStateDescriptionText }}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\n\t\t<div class="ui-checkbox-list__footer">\n\t\t\t<div class="ui-checkbox-list__footer-block">\n\t\t\t\t<div\n\t\t\t\t\tclass="ui-checkbox-list__footer-link --default"\n\t\t\t\t\t@click="defaultSettings()"\n\t\t\t\t>\n\t\t\t\t\t{{ defaultSettingsBtnText }}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="ui-checkbox-list__footer-block">\n\t\t\t\t<button\n\t\t\t\t\t@click="apply()"\n\t\t\t\t\tclass="ui-btn ui-btn-success">\n\t\t\t\t\t{{ applyBtnText }}\n\t\t\t\t</button>\n\n\t\t\t\t<button\n\t\t\t\t\t@click="cancel()"\n\t\t\t\t\tclass="ui-btn ui-btn-link"\n\t\t\t\t>\n\t\t\t\t\t{{ cancelBtnText }}\n\t\t\t\t</button>\n\t\t\t</div>\n\t\t\t<div class="ui-checkbox-list__footer-block --right">\n\t\t\t\t<div\n\t\t\t\t\t@click="selectAll()"\n\t\t\t\t\tclass="ui-checkbox-list__footer-link"\n\t\t\t\t>\n\t\t\t\t\t{{ selectAllBtnText }}\n\t\t\t\t</div>\n\t\t\t\t<div\n\t\t\t\t\t@click="deselectAll()"\n\t\t\t\t\tclass="ui-checkbox-list__footer-link"\n\t\t\t\t>\n\t\t\t\t\t{{ deselectAllBtnText }}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t\t</div>\n\t'};function h(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function d(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?h(Object(n),!0).forEach((function(e){babelHelpers.defineProperty(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var p=function(t){babelHelpers.inherits(e,t);function e(t){var n;babelHelpers.classCallCheck(this,e);n=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(e).call(this));n.setEventNamespace("BX.UI.Dialogs.CheckboxList");n.subscribeFromOptions(t.events);if(!l.Type.isArrayFilled(t.categories)){throw new Error('CheckboxList: "categories" parameter is required.')}n.categories=t.categories;if(!l.Type.isArrayFilled(t.options)){throw new Error('CheckboxList: "options" parameter is required.')}n.options=t.options;n.compactField=l.Type.isPlainObject(t.compactField)?t.compactField:null;n.sections=l.Type.isArray(t.sections)?t.sections:null;n.lang=l.Type.isPlainObject(t.lang)?t.lang:{};n.popup=null;n.columnCount=l.Type.isNumber(t.columnCount)?t.columnCount:4;n.popupOptions=l.Type.isPlainObject(t.popupOptions)?t.popupOptions:{};return n}babelHelpers.createClass(e,[{key:"getPopup",value:function t(){var e=l.Dom.create("div");l.Dom.addClass(e,"ui-checkbox-list__app-container");if(!this.popup){this.popup=new n.Popup(d({className:"ui-checkbox-list-popup",width:997,overlay:true,autoHide:true,minHeight:422,borderRadius:20,contentPadding:0,contentBackground:"transparent",animation:"fading-slide",titleBar:this.lang.title,content:e,closeIcon:true,closeByEsc:true},this.popupOptions));i.BitrixVue.createApp(u,{compactField:this.compactField,lang:this.lang,sections:this.sections,categories:this.categories,options:this.options,popup:this.popup,columnCount:this.columnCount,dialog:this}).mount(e)}return this.popup}},{key:"show",value:function t(){this.getPopup().show()}},{key:"hide",value:function t(){this.getPopup().hide()}}]);return e}(s.EventEmitter);t.CheckboxList=p})(this.BX.UI=this.BX.UI||{},BX,BX.Main,BX.Vue3,BX,BX,BX.Event,BX);
//# sourceMappingURL=bundle.map.js